package com.github.ecbp.common.data.seata;

import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component;

/**
 * @description: seata
 * @author: chentuan
 * @create: 2020-05-19 15:23
 **/
@Component
public class SeataConfigureBean {

    @Bean
    public PropertySourcesPlaceholderConfigurer seataDev() {
        PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
        YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
        yaml.setResources(new ClassPathResource("seata-dev.yml"));
        configurer.setProperties(yaml.getObject());
        return configurer;
    }
}
